<%@page import="com.bill.common.system.dto.RuleDTO"%>
<%@page import="com.bill.common.system.service.IRuleService"%>
<%@page import="org.springframework.web.context.support.WebApplicationContextUtils"%>
<%@page import="org.springframework.context.ApplicationContext"%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>

<%@ include file="../language.jsp" %>
<%
ApplicationContext ac = WebApplicationContextUtils.getWebApplicationContext(getServletContext());
IRuleService ruleService = (IRuleService)ac.getBean("ruleService");
RuleDTO ruleDTO = ruleService.findRuleInfo();
request.setAttribute("ruleDTO",ruleDTO);
request.setAttribute("errorInfo",request.getParameter("error"));
request.setAttribute("loginName",request.getParameter("loginName"));

%>

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title><fmt:message key="i18n.findPassword" />-<fmt:message key="i18n.title"/></title>
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<link rel="shortcut icon" href="../images/favicon.png" />
<link rel="stylesheet" type="text/css" href="css/style1.css" />
<link href="../skin/skin1/css/css.css" rel="stylesheet">
<link rel="stylesheet" href="css/compiled/signin.css" type="text/css" media="screen" />
<script  type="text/javascript"  src="../scripts/common.js"></script>  
<script type="text/javascript" src="../scripts/user/common.js"></script>

</head>
<body class="login-bg" style='background-image: url("img/bgs/blueish.jpg");'>
  <div class="Login logoCont">
  <div class="logoCont1200">
    <form action="registerUser!getBack.action" method="post" class="login_form" id="my-form">
      <input type="hidden" name="pageUrl" value="findPwd.jsp" >
      <h2>
     	<fmt:message key="i18n.findPassword" />
      	<span style="float: right;padding-right: 10px;font-size: 14px;">
      		<a href="login.jsp">&gt;&gt;<fmt:message key="i18n.login" /></a>
      	</span>
      </h2>
      <div class="bd" style="height:530px;">
        <ul>
          <li>
            <div class="left"><i>*</i><fmt:message key="i18n.userLogin" />：</div>
            <div class="right">
            <input name="registerUserDTO.loginName" id="loginName" type="text" placeholder="<fmt:message key="i18n.loginUserName" />" class="srk1" />
            </div>
          </li>
          <li>
			<div class="left"><i>*</i><fmt:message key="i18n.loginPassword" />：</div>
			<div class="right"><input type="password" class="srk1" placeholder="<fmt:message key="i18n.regInputPwd" />"
				name="registerUserDTO.password1" id="cp1_newPassword" /></div>
          </li>
          <li>
			<div class="left"><i>*</i><fmt:message key="i18n.cofimPassword" />：</div>
			<div class="right"><input type="password" class="srk1" placeholder="<fmt:message key="i18n.regInputRepwd" />"
				id="cp1_repassword"  /></div>
          </li>
          
           <li>
			<div class="left"><i>*</i><fmt:message key="i18n.send2Password" />：</div>
			<div class="right"><input type="password" class="srk1" placeholder="<fmt:message key="i18n.regInputPwd" />"
				name="registerUserDTO.password2" id="cp2_newPassword" /></div>
          </li>
          <li>
			<div class="left"><i>*</i><fmt:message key="i18n.cofimPassword" />：</div>
			<div class="right"><input type="password" class="srk1" placeholder="<fmt:message key="i18n.regInputRepwd" />"
				id="cp2_repassword"  /></div>
          </li>
          
          <li>
            <div class="left"><i>*</i><fmt:message key="i18n.mobileCode" />：</div>
            <div class="right">
            	<input type="text" id="registerAuthCode" name="registerUserDTO.authCode" placeholder="<fmt:message key="i18n.regInputVerificationCode" />" class="srk1"/>
            </div>
          </li>
          <li>
            <div class="left">&nbsp;</div>
            <div class="right">
            	<input id="getRegisterAuthCode" type="button" value="<fmt:message key="i18n.getVerificationCode" />" class="yz" onclick="getVerificationCode('Mobile','FindPassword','#loginName','#getRegisterAuthCode',true)"/><br/>
            	<!-- <span id="registerAccount_show">&nbsp;</span> -->
            </div>
          </li>
          <li>
            <div class="left"><i>*</i><fmt:message key="i18n.valicode" />：</div>
            <div class="right"><input id="userLogin_validCode" name="code" type="text" placeholder="<fmt:message key="i18n.regInputVerificationCode" />" class="srk1"><span style="float: right; padding-right: 120px;">
            </span></div>
          </li>
          <li>
            <div class="left">&nbsp;</div>
            <div class="right">
            <span style=" padding-right: 120px;">
            <a href="javascript:refreshCheckCode('login_codeImg');"> <img id="login_codeImg" border=0 src="randomCode" class="yzm"/></a>
            </span></div>
          </li>
          <li>
          	<input type="button" onclick="findPwd( )" class="ty_an" value="<fmt:message key="i18n.submitVil" />" />
          </li>
          <li> <span style="color: red;font-weight: 500;margin-bottom: 10px;">${resultStr }</span></li>
          
        </ul>
       
      </div>
    </form>
    </div>
  </div>
<script src="../scripts/jquery-1.11.0.min.js"></script>
<script type="text/javascript">
	function findPwd(){
		if($('#loginName').val()=='' || $('#loginName').val()=='会员编号'){
			alert('请输入登入账号!');
			$('#loginName').focus();
			return false;
		}
		if($('#cp1_newPassword').val()=='' ){
			alert('新密码不能为空!'); $('#cp1_newPassword').focus();
			return false;
		}
		if($('#cp1_repassword').val() != $('#cp1_newPassword').val() ){
			alert('确认密码与新密码不一致'); $('#cp1_repassword').focus();
			return false;
		}
		if($('#cp2_newPassword').val()=='' ){
			alert('新密码不能为空!'); $('#cp2_newPassword').focus();
			return false;
		}
		if($('#cp2_repassword').val() != $('#cp2_newPassword').val() ){
			alert('确认密码与新密码不一致'); $('#cp2_repassword').focus();
			return false;
		}
		
		/* if($('#password').val()=='' || $('#password').val()=='密码'){
			alert('Please enter the password(请输入密码)!');
			$('#password').focus();
			return false;
		} */
		
		if( $('#registerAuthCode').val()=='' || $('#registerAuthCode').val()=='验证码'){
			alert('请输入验证码!');
			$('#registerAuthCode').focus();
			return false;
		}
		if( $('#userLogin_validCode').val()=='' || $('#userLogin_validCode').val()=='验证码'){
			alert('请输入验证码!');
			$('#userLogin_validCode').focus();
			return false;
		}
		
		
		
		var validCode = $('#userLogin_validCode').val();
		$.get('getCode.jsp'+'?random='+Math.random()*10+1,function(res){
			 res=res.replace(/(^\s*)|(\s*$)/g, ""); 
			 if(validCode==res){
				$('#my-form').submit();
			}else{
				alert('验证码不正确!');
			}
		});
		
		
	}
	$(function(){
		document.onkeydown = function(evt){
			var evt = window.event?window.event:evt;
			if(evt.keyCode==13){
				findPwd();
			}
		}
	});
</script>
</body>
</html>